package ontocompo.ui.merge;

import java.awt.Component;

import javax.swing.JButton;

import ontocompo.ui.screenmanagement.Screen;

public class ParallelOperator extends Operator {
	
	@Override
	public Component perform(Component first, Component second, Screen s) {
//		System.err.println("perform");
		
//		System.err.println(first.getClass());
//		System.err.println(second.getClass());
//		if(first.getClass().isAssignableFrom(JButton.class) && second.getClass().isAssignableFrom(JButton.class)) {
//			System.err.println("perform OK");
			s.removeFromBulkList(first);
			s.removeFromBulkList(second);
			
			JButton firstB = (JButton) first;
			JButton secondB = (JButton) second;
			
			JButton jb = new JButton(firstB.getText() + " - " + secondB.getText());
			
			s.addInBulk(jb);
			
			s.addInPluggedComponents(new PlugComponent(first, second, this, jb));
			
			return jb;
//		}
//		System.err.println("perform returned null");
//		return null;
	}
	
	public String toString() {
		return "Parallel Operator";
	}

}
